# frozen_string_literal: true
class CreateInterviews < ActiveRecord::Migration[5.0]
  def change
    create_table :interviews do |t|
      t.references :village, foreign_key: true
      t.references :building, foreign_key: true
      t.references :user, foreign_key: true
      t.references :guest, foreign_key: true

      t.datetime :entered_at
      t.datetime :exited_at

      t.string :car_code
      t.string :access_code
      t.string :door_name
      t.string :keyword
      t.string :reason

      t.boolean :flag, default: true

      t.timestamps
    end
  end
end

# {
#   "name": "来访人名字",
#   "gender": "来访人性别",
#   "nation": "来访人民族",
#   "photo": "来访人身份证头像 base64",
#   "birthday": "来访人生日",
#   "address": "来访人身份证住址",
#   "card_code": "身份证号码",
#   "card_valid": true,
#   "expired_at": "身份证过期时间",
#   "entered_at": "进入时间",
#   "exited_at": "离开时间",
#   "reason": "来访原因",
#   "flag": true,
#   "access_code": "小票号码",
#   "keyword": "受访者的 门牌 地址 手机号码",
#   "door_name": "小区门"
# }
